home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / src / Date_Time / Date_Time.h < prev    next >
Text File  |  1992-05-14  |  23KB  |  560 lines

  1. //
  2. // Copyright (C) 1991 Texas Instruments Incorporated.
  3. //
  4. // Permission is granted to any individual or institution to use, copy, modify,
  5. // and distribute this software, provided that this complete copyright and
  6. // permission notice is maintained, intact, in all copies and supporting
  7. // documentation.
  8. //
  9. // Texas Instruments Incorporated provides this software "as is" without
  10. // express or implied warranty.
  11. //
  12. //
  13. // Created: MBN 04/11/89 -- Initial design and implementation
  14. // Updated: LGO 07/03/89 -- Inherit from Generic
  15. // Updated: MNF 07/25/89 -- Add the parse member function 
  16. // Updated: MBN 09/06/89 -- Added conditional exception handling
  17. // Updated: MBN 01/17/90 -- Fixed parsing algorithms to be GMT relative
  18. // Updated: MBN 02/06/90 -- Support years prior to the epoch (1/1/1970)
  19. // Updated: MBN 02/12/90 -- Changed all ascii() functions to return const char*
  20. // Updated: MBN 02/13/90 -- Made ascii_duration() a member function for epoch
  21. // Updated: DLS 03/22/91 -- New lite version
  22. //
  23. // The Date_Time class provides  an   application programmer  with  simplified
  24. // access to the operating system date and time values, along with support for
  25. // comparison to other dates and times, calendar adjustment, and international
  26. // support  for   display formats.   To  implement  this functionality,  three
  27. // additional header files  are maintained: <country.h> providing symbolic and
  28. // character    string  definitions  for      the various supported  contries;
  29. // <timezone.h>  that enumerates symbolic  and character string values for all
  30. // major  time zones; and <calendar.h>  that  lists  the days of the week  and
  31. // months of the year.  The following countries and their associated date/time
  32. // format are supported:
  33. //
  34. //                United States          03-29-1989 17:35:00
  35. //                French Canadian        1989-29-03 17:35:00
  36. //                Latin America          03/29/1989 17:35:00
  37. //                Netherlands            03-29-1989 17:35:00
  38. //                Belgium                03/29/1989 17:35:00
  39. //                France                 03/29/1989 17:35:00
  40. //                Spain                  03/29/1989 17:35:00
  41. //                Italy                  03/29/1989 17:35:00
  42. //                Switzerland            03.29.1989 17.35.00
  43. //                United Kingdom         29-03-1989 17:35:00
  44. //                Denmark                03/29/1989 17:35:00
  45. //                Sweden                 1989-29-03 17.35.00
  46. //                Norway                 03/29/1989 17:35:00
  47. //                Germany                03.29.1989 17.35.00
  48. //                Portugal               03/29/1989 17:35:00
  49. //                Finland                03.29.1989 17.35.00
  50. //                Arabic Countries       03/29/1989 17:35:00
  51. //                Israel                 03 29 1989 17:35:00
  52. //
  53. // The private data section contains a  long integer that  maintains the system
  54. // date and  time as an interval  from the base  date of 01/01/1970 00:00:00am.
  55. // This  is supported  and  structure  in an ANSI  C <time.> tm structure that
  56. // keeps separate fields for seconds,  minutes, hours,  day   of month, day  of
  57. // week, month, year, and day of year.  Two other slots  provided time zone and
  58. // country code values for   each  Date_Time object.   In addition,  two static
  59. // slots containing  the default time zone and  country code for the  Date_Time
  60. // class as a whole are defined.  The following time zones are supported:
  61. //  
  62. //        US/Eastern:                  Eastern time zone, USA                 
  63. //        US/Central:                  Central time zone, USA                 
  64. //        US/Mountain:                 Mountain time zone, USA                
  65. //        US/Pacific:                  Pacific time zone, USA                 
  66. //        US/Pacific-New:              Pacific time zone, USA with DST changes
  67. //        US/Yukon:                    Yukon time zone, USA                   
  68. //        US/East-Indiana:             Estern time zone, USA with no DST      
  69. //        US/Arizona:                  Mountain time zone, USA with no DST    
  70. //        US/Hawaii:                   Hawaii                                 
  71. //        Canada/Newfoundland:         Newfoundland                           
  72. //        Canada/Atlantic:             Atlantic time zone, Canada             
  73. //        Canada/Eastern:              Eastern time zone, Canada              
  74. //        Canada/Central:              Central time zone, Canada              
  75. //        Canada/East-Saskatchewan:    Central time zone, Canada with no DST  
  76. //        Canada/Mountain:             Mountain time zone, Canada             
  77. //        Canada/Pacific:              Pacific time zone, Canada              
  78. //        Canada/Yukon:                Yukon time zone, Canada                
  79. //        GB-Eire:                     Great Britain and Eire (GMT)           
  80. //        WET:                         Western Europe time                    
  81. //        Iceland:                     Iceland                                
  82. //        MET:                         Middle Europe time                     
  83. //        Poland:                      Poland                                 
  84. //        EET:                         Eastern Europe time                    
  85. //        Turkey:                      Turkey                                 
  86. //        W-SU:                        Western Soviet Union                   
  87. //        PRC:                         People's Republic of China             
  88. //        Korea:                       Republic of Korea                      
  89. //        Japan:                       Japan                                  
  90. //        Singapore:                   Singapore                              
  91. //        Hongkong:                    Hongkong                               
  92. //        ROC:                         Republic of China                      
  93. //        Australia/Tasmania:          Tasmainia, Australia                   
  94. //        Australia/Queensland:        Queensland, Australia                  
  95. //        Australia/North:             Northern Territory, Australia          
  96. //        Australia/West:              Western Australia                      
  97. //        Australia/South:             South Australia                        
  98. //        Australia/Victoria:          Victoria, Australia                    
  99. //        Australia/NSW:               New South Wales, Australia             
  100. //        NZ:                          New Zealand                            
  101. //
  102. // There are five constructors for the Date_Time  class.  The first constructor
  103. // takes no arguments and intializes an empty object, setting the time zone and
  104. // the  country  code   to  the  default values   for  the class.   The  second
  105. // constructors takes a time  zone and country code and  initializes an  object
  106. // for the specified local time zone and  country.  The third constructor takes
  107. // a reference to some  other Date_Time object and  copies all the slot values.
  108. // To get the time from a char*, first  create an  object with its country code
  109. // set, and then use parse to fill in the slots.
  110. //
  111. // Public methods are provided for incrementing and  decrementing  the date and
  112. // time, various   logical  tests   for  equality and  inequality,    and ASCII
  113. // representation  of the   date  and/or  time   formatted   according  to  the
  114. // appropriate country standard.  Two methods are  provided  to set a Date_Time
  115. // object to either  the local time  (adjusted for  day  light savings time, if
  116. // necessary) and  Greenwich Mean Time.   In  addition, several  public methods
  117. // have been implemented for  interval arithmetic allowing messages  to be sent
  118. // to the object along the lines of "move forward three weeks", "back up to end
  119. // of last  month", etc.  Two  methods are  provided to  change the   time zone
  120. // and/or country for a particular Date_Time object.  Finally accessors for all
  121. // fields in the  <time.h> structure and  the  ASCII representation of the time
  122. // zone and country are provided.
  123. //
  124. // Two other methods are also  implemented to  be used by  other methods of the
  125. // class.  The first is a private member function that maintains  the integrity
  126. // of   a  Date_Time object after  interval  arithmetic,  updating  to the next
  127. // hour/day/month, etc.   The second is a  private friend function that takes a
  128. // time zone value and  updates the local time  conversion information used for
  129. // converting between GMT and the specified time zone.
  130.  
  131. #ifndef DATETIMEH                // If we have not defined class
  132. #define DATETIMEH                // Indicate class Date_Time
  133.  
  134. #if defined(DOS)
  135. extern "C" {
  136. #include <time.h>
  137. }
  138. #else
  139. #include <sys/time.h>
  140. #endif
  141.  
  142. #ifndef STREAMH            // If the Stream support not yet defined,
  143. #if defined(DOS) || defined(M_XENIX)
  144. #include <stream.hxx>        // include the Stream class header file
  145. #else
  146. #include <stream.h>        // include the Stream class header file
  147. #endif
  148. #define STREAMH
  149. #endif
  150.  
  151. #ifndef MISCELANEOUSH                // If no misc.h file
  152. #include <misc.h>            // Include useful defintions
  153. #endif    
  154.  
  155. #ifndef CHARH
  156. #include <cool/char.h>
  157. #endif
  158.  
  159. #ifndef STRINGH
  160. #include <cool/String.h>
  161. #endif
  162.  
  163. #ifndef COUNTRYH
  164. #include <cool/country.h> 
  165. #endif
  166.  
  167. #ifndef TIMEZONEH
  168. #include <cool/timezone.h>
  169. #endif
  170.  
  171. #ifndef CALENDARH
  172. #include <cool/calendar.h>
  173. #endif
  174.  
  175. class CoolDate_Time {
  176. public:
  177.   CoolDate_Time ();                // Simple constructor
  178.   CoolDate_Time (time_zone, country);        // Constructor with TZ/Country
  179.   CoolDate_Time (const CoolDate_Time&);        // Constructor with reference
  180.   ~CoolDate_Time ();                // Destructor
  181.   
  182.   void set_gm_time ();                          // Sets Greenwich Mean Time
  183.   void set_local_time ();                       // Sets local time 
  184.   inline void set_time_zone (time_zone);    // Set time zone for object
  185.   inline void set_country (country);        // Set country for object
  186.   inline friend void set_default_time_zone (time_zone);// Set default time zone
  187.   inline friend void set_default_country (country);    // Set default country
  188.  
  189.   CoolDate_Time& operator= (const CoolDate_Time&); // CoolDate_Time x = y;
  190.   inline long operator- (const CoolDate_Time&) const; // Interval subtraction
  191.   CoolDate_Time& operator+= (long);              // Interval addition/assignment
  192.   CoolDate_Time& operator-= (long);              // Interval subtraction/assign
  193.  
  194.   friend istream& operator>> (istream&, CoolDate_Time&);
  195.   friend ostream& operator<< (ostream&, const CoolDate_Time&);
  196.   inline friend ostream& operator<< (ostream&, const CoolDate_Time*);
  197.   
  198.   void incr_sec (int n = 1);                    // Advance seconds (default 1)
  199.   void incr_min (int n = 1);                    // Advance minutes (default 1)
  200.   void incr_hour (int n = 1);                   // Advance hours (default 1)
  201.   void incr_day (int n = 1);                    // Advance day (default 1)
  202.   void incr_week (int n = 1);                   // Advance week (default 1)
  203.   void incr_month (int n = 1);                  // Advance month (default 1)
  204.   void incr_year (int n = 1);                   // Advance year (default 1)
  205.   
  206.   inline void decr_sec (int n = 1);             // Decrement second (default 1)
  207.   inline void decr_min (int n = 1);             // Decrement minute (default 1)
  208.   inline void decr_hour (int n = 1);            // Decrement hours (default 1)
  209.   inline void decr_day (int n = 1);             // Decrement day (default 1)
  210.   inline void decr_week (int n = 1);            // Decrement week (default 1)
  211.   void decr_month (int n = 1);                  // Decrement month (default 1)
  212.   void decr_year (int n = 1);                   // Decrement year (default 1)
  213.   
  214.   void start_min (int n = 1);   // Change to start of +/- "n" minute (default 1
  215.   void end_min (int n = 1);     // Change to end of +/- "n" minutes (default 1)
  216.   void start_hour (int n = 1);  // Change to start of +/- "n" hours (default 1)
  217.   void end_hour (int n = 1);    // Change to end of +/- "n" hours (default 1)
  218.   void start_day (int n = 1);   // Change to start of +/- "n" days (default 1)
  219.   void end_day (int n = 1);     // Change to end of +/- "n" days (default 1)
  220.   void start_week (int n = 1);  // Change to start of +/- "n" weeks (default 1)
  221.   void end_week (int n = 1);    // Change to end of +/- "n" weeks (default 1)
  222.   void start_month (int n = 1); // Change to start of +/- "n" month (default 1)
  223.   void end_month (int n = 1);   // Change to end of +/- "n" months (default 1)
  224.   void start_year (int n = 1);  // Change to start of +/- "n" years (default 1)
  225.   void end_year (int n = 1);    // Change to end of +/- "n" years (default 1)
  226.  
  227.   inline Boolean operator== (const CoolDate_Time&) const; // is same date/time
  228.   inline Boolean operator!= (const CoolDate_Time&) const; // is not same date/time
  229.   inline Boolean operator< (const CoolDate_Time&) const;  // is earlier date/time
  230.   inline Boolean operator> (const CoolDate_Time&) const;  // is later date/time
  231.   inline Boolean operator<= (const CoolDate_Time&) const; // is earlier or same
  232.   inline Boolean operator>= (const CoolDate_Time&) const; // is later or same
  233.  
  234.   const char* ascii_time () const;    // Return time in ASCII country format
  235.   const char* ascii_date () const;    // Return date in ASCII country format
  236.   const char* ascii_date_time () const;    // Return date/time ASCII country form
  237.   const char* ascii_duration (const CoolDate_Time&) const; // Return time duration 
  238.   void parse (char*, int settz = 0);    // Parses char* into the CoolDate_Time
  239.  
  240.   inline int get_sec () const;          // Return seconds from tm struct
  241.   inline int get_min () const;        // Return minutes from tm struct
  242.   inline int get_hour () const;        // Return hours from tm struct
  243.   inline int get_mday () const;        // Return day of month from tm struct
  244.   inline int get_mon () const;        // Return month from tm struct
  245.   inline int get_year () const;        // Return year from tm struct
  246.   inline int get_wday () const;        // Return day of week from tm struct
  247.   inline int get_yday () const;        // Return day of year from tm struct
  248.   inline Boolean is_day_light_savings () const; // Return daylight savings flag
  249.   inline const char* get_time_zone () const ; // Return ASCII form of time zone
  250.   inline const char* get_country () const; // Return ASCII form of country 
  251.   inline const char* get_day_name () const; // Return ASCII form of week day
  252.   inline const char* get_month_name () const; // Return ASCII form of month
  253.   
  254. private:
  255.   long time_seconds;                // Seconds 01/01/1970 00:00:00
  256.   /*struct*/ tm dt;                // OS date/time structure
  257.   country c_code;                // Retains date/time country
  258.   time_zone tz_code;                // Retains time zone code
  259.   long time_adjust;                // Time zone offset in seconds
  260.   int year_adjust;                // Year offset prior to epoch
  261.   int century;                    // Maintains century of year
  262.  
  263.   static time_zone default_tz_code_s;        // Default time zone
  264.   static country default_c_code_s;        // Default country
  265.   void resolve ();                // Resolve/update object
  266.   void adjust_tz ();                // Adjust for local time zone
  267.   void adjust_year (long&);            // Adjust for years < 1/1/1970
  268.   friend void set_tz (time_zone);        // Setup for local time zone
  269.   
  270.   friend int inrange (char);            // Helper function for parser
  271.   friend void getzone (CoolDate_Time&, char*);    // Gets time zone for parser
  272. };
  273.  
  274.  
  275. // set_time_zone -- Set the local time zone of a CoolDate_Time object
  276. // Input:           Time zone
  277. // Output:          None
  278.  
  279. inline void CoolDate_Time::set_time_zone (time_zone tz) {
  280.   this->tz_code = tz;
  281.   this->resolve ();
  282. }
  283.  
  284.  
  285. // set_country -- Set the country of a CoolDate_Time object
  286. // Input:         Country code
  287. // Output:        None
  288.  
  289. inline void CoolDate_Time::set_country (country c) {
  290.   this->c_code = c;
  291. }
  292.  
  293.  
  294. // set_default_time_zone -- Set the default time zone of the CoolDate_Time class
  295. // Input:           Time zone
  296. // Output:          None
  297.  
  298. inline void set_default_time_zone (time_zone tz) {
  299.   CoolDate_Time::default_tz_code_s = tz;
  300. }
  301.  
  302.  
  303. // set_default_country -- Set the default country of the CoolDate_Time class
  304. // Input:         Country code
  305. // Output:        None
  306.  
  307. inline void set_default_country (country c) {
  308.   CoolDate_Time::default_c_code_s = c;
  309. }
  310.  
  311.  
  312. // operator- -- Subtract one CoolDate_Time from a another to calculate
  313. //              the time interval between
  314. // Input:       this*, CoolDate_Time reference
  315. // Output:      Number of seconds presenting time interval 
  316.  
  317. inline long CoolDate_Time::operator- (const CoolDate_Time& d) const {
  318.   return (this->time_seconds - d.time_seconds);
  319. }
  320.  
  321.  
  322. // decr_sec -- Retreat Date/Time by "n" second(s)
  323. // Input:      Number of seconds to retreat (default 1)
  324. // Output:     None -- CoolDate_Time object updated 
  325.  
  326. inline void CoolDate_Time::decr_sec (int n) {
  327.   incr_sec (-n);
  328. }
  329.  
  330.  
  331. // decr_min -- Retreat Date/Time by "n" minute(s)
  332. // Input:      Number of minutes to retreat (default 1)
  333. // Output:     None -- CoolDate_Time object updated 
  334.  
  335. inline void CoolDate_Time::decr_min (int n) {
  336.   incr_min (-n);
  337. }
  338.  
  339.  
  340. // decr_hour -- Retreat Date/Time by "n" hour(s)
  341. // Input:       Number of hours to retreat (default 1)
  342. // Output:      None -- CoolDate_Time object updated 
  343.  
  344. inline void CoolDate_Time::decr_hour (int n) {
  345.   incr_hour (-n);
  346. }
  347.  
  348.  
  349. // decr_day -- Retreat Date/Time by "n" day(s)
  350. // Input:      Number of days to retreat (default 1)
  351. // Output:     None -- CoolDate_Time object updated 
  352.  
  353. inline void CoolDate_Time::decr_day (int n) {
  354.   incr_day (-n);
  355. }
  356.  
  357.  
  358. // decr_week -- Retreat Date/Time by "n" week(s)
  359. // Input:       Number of weeks to retreat (default 1)
  360. // Output:      None -- CoolDate_Time object updated 
  361.  
  362. inline void CoolDate_Time::decr_week (int n) {
  363.   incr_week (-n);
  364. }
  365.  
  366.  
  367. // operator== -- Determine if two CoolDate_Time objects represent the
  368. //               same point in time
  369. // Input:        this*, CoolDate_Time reference
  370. // Output:       TRUE/FALSE boolean value
  371.  
  372. inline Boolean CoolDate_Time::operator== (const CoolDate_Time& d) const {
  373.   return ((this->time_seconds == d.time_seconds) ? TRUE : FALSE);
  374. }
  375.  
  376.  
  377. // operator!= -- Determine if two CoolDate_Time objects represent 
  378. //               different points in time
  379. // Input:        this*, CoolDate_Time reference
  380. // Output:       TRUE/FALSE Boolean value
  381.  
  382. inline Boolean CoolDate_Time::operator!= (const CoolDate_Time& d) const {
  383.   return ((this->time_seconds != d.time_seconds) ? TRUE : FALSE);
  384. }
  385.  
  386.  
  387. // operator< -- Determine if one CoolDate_Time object comes before
  388. //              some other point in time
  389. // Input:       this*, CoolDate_Time reference
  390. // Output:      TRUE/FALSE Boolean value
  391.  
  392. inline Boolean CoolDate_Time::operator< (const CoolDate_Time& d) const {
  393.   return ((this->time_seconds < d.time_seconds) ? TRUE : FALSE);
  394. }
  395.  
  396.  
  397. // operator> -- Determine if one CoolDate_Time object comes aftern
  398. //              some other point in time
  399. // Input:       this*, CoolDate_Time reference
  400. // Output:      TRUE/FALSE Boolean value
  401.  
  402. inline Boolean CoolDate_Time::operator> (const CoolDate_Time& d) const {
  403.   return ((this->time_seconds > d.time_seconds) ? TRUE : FALSE);
  404. }
  405.  
  406.  
  407. // operator<= -- Compare one CoolDate_Time object to see if it lies before
  408. //               or is the same as another CoolDate_Time object
  409. // Input:        this*, CoolDate_Time reference
  410. // Output:       TRUE/FALSE Boolean value
  411.  
  412. inline Boolean CoolDate_Time::operator<= (const CoolDate_Time& d) const {
  413.   return ((this->time_seconds <= d.time_seconds) ? TRUE : FALSE);
  414. }
  415.  
  416.  
  417. // operator>= -- Compare one CoolDate_Time object to see if it lies after
  418. //               or is the same as another CoolDate_Time object
  419. // Input:        this*, CoolDate_Time reference
  420. // Output:       TRUE/FALSE boolean value
  421.  
  422. inline Boolean CoolDate_Time::operator>= (const CoolDate_Time& d) const {
  423.   return ((this->time_seconds >= d.time_seconds) ? TRUE : FALSE);
  424. }
  425.  
  426.  
  427. // get_sec -- Accessor to seconds slot value
  428. // Input:     this* 
  429. // Output:    Integer representing number of seconds
  430.  
  431. inline int CoolDate_Time::get_sec () const {
  432.   return (this->dt.tm_sec);
  433. }
  434.  
  435.  
  436. // get_min -- Accessor to minutes slot value
  437. // Input:     this* 
  438. // Output:    Integer representing number of minutes
  439.  
  440. inline int CoolDate_Time::get_min () const {
  441.   return (this->dt.tm_min);
  442. }
  443.  
  444.  
  445. // get_hour -- Accessor to hour slot value
  446. // Input:      this* 
  447. // Output:     Integer representing number of hour
  448.  
  449. inline int CoolDate_Time::get_hour () const {
  450.   return (this->dt.tm_hour);
  451. }
  452.  
  453.  
  454. // get_mday -- Accessor to day of month slot value
  455. // Input:      this* 
  456. // Output:     Integer representing day of month
  457.  
  458. inline int CoolDate_Time::get_mday () const {
  459.   return (this->dt.tm_mday);
  460. }
  461.  
  462.  
  463. // get_mon -- Accessor to month slot value
  464. // Input:     this* 
  465. // Output:    Integer representing month
  466.  
  467. inline int CoolDate_Time::get_mon () const {
  468.   return (this->dt.tm_mon);
  469. }
  470.  
  471.  
  472. #define YEAR_PERIOD 28
  473. #define NEW_YEAR(x) (((x / YEAR_PERIOD) * YEAR_PERIOD) + YEAR_PERIOD)
  474. #define OLD_YEAR(x,y) (x - NEW_YEAR (y))
  475.  
  476.  
  477. // get_year -- Accessor to year slot value
  478. // Input:      this* 
  479. // Output:     Integer representing year
  480.  
  481. inline int CoolDate_Time::get_year () const {
  482.   return ((this->year_adjust > 0) ? (this->century+OLD_YEAR (this->dt.tm_year,
  483.                            this->year_adjust)) :
  484.       this->century + this->dt.tm_year);
  485. }
  486.  
  487.  
  488. // get_yday -- Accessor to day of year slot value
  489. // Input:      this* 
  490. // Output:     Integer representing day of year
  491.  
  492. inline int CoolDate_Time::get_yday () const {
  493.   return (this->dt.tm_yday);
  494. }
  495.  
  496.  
  497. // get_wday -- Accessor to day of week slot value
  498. // Input:      this* 
  499. // Output:     Integer representing day of week
  500.  
  501. inline int CoolDate_Time::get_wday () const {
  502.   return (this->dt.tm_wday);
  503. }
  504.  
  505.  
  506. // is_day_light_savings -- Accessor to Day Light Savings time flag
  507. // Input:                  this* 
  508. // Output:                 TRUE/FALSE if in effect
  509.  
  510. inline Boolean CoolDate_Time::is_day_light_savings () const {
  511.   return ((this->dt.tm_isdst) ? TRUE : FALSE);
  512. }
  513.  
  514.  
  515. // get_time_zone -- Accessor to ASCII representation of time zone
  516. // Input:           this* 
  517. // Output:          character string representing time zone
  518.  
  519. inline const char* CoolDate_Time::get_time_zone () const {
  520.   return (tz_table[this->tz_code]);
  521. }
  522.  
  523.  
  524. // get_country -- Accessor to country code slot value
  525. // Input:         this* 
  526. // Output:        character string representing country
  527.  
  528. inline const char* CoolDate_Time::get_country () const {
  529.   return (country_names[this->c_code]);
  530. }
  531.  
  532.  
  533. // get_day_name -- Accessor to ASCII representation of week day
  534. // Input:         this* 
  535. // Output:        character string representing day of week
  536.  
  537. inline const char* CoolDate_Time::get_day_name () const {
  538.   return (day_names[this->dt.tm_wday]);
  539. }
  540.  
  541.  
  542. // get_month_name -- Accessor to ASCII representation of month
  543. // Input:         this* 
  544. // Output:        character string representing month
  545.  
  546. inline const char* CoolDate_Time::get_month_name () const {
  547.   return (month_names[this->dt.tm_mon]);
  548. }
  549.  
  550. // operator<< -- Output CoolDate_Time object to output stream
  551. // Input:        Output stream reference, CoolDate_Time pointer
  552. // Output:       Output stream reference
  553.  
  554. inline ostream& operator<< (ostream& os, const CoolDate_Time* d) {
  555.   return  os << *d;
  556. }
  557.  
  558.  
  559. #endif                                          // End of DATETIMEH
  560.